#!/usr/bin/env python

n = 7
k = 3
seq = []

nr = 0

def out_res():
	global nr 
	nr += 1
	#print seq

def dfs(lvl): 
	global seq
	if lvl>=k-1: 
		last = n-sum(seq)
		if last<seq[-1]:
			return -1
		seq.append(last)
		out_res()
		seq.pop(-1)
		return 0
	total = sum(seq)
	left = n - total
	if left<total:
		return -1
	st = seq[-1] if len(seq)>0 else 1
	for i in range(st, left+1): 
		seq.append(i)
		r = dfs(lvl+1)
		seq.pop(-1)
		if r<0: 
			break
	return 0

dfs(0)
print nr
